const arr1 = [{ id: 1 }, { id: 2 }, { id: 3 }];
const arr2 = [{ id: 3 }, { id: 4 }, { id: 5 }];

function mergeArray(arr1, arr2) {
    // 克隆
    const cloneArr1 = arr1.slice(0);
    let v;
    for (let i = 0; i < arr2.length; i++) {
        v = arr2[i];
        // 能找到相同 id 属性值的数据则进入判断
        if (~cloneArr1.findIndex((el) => el.id === v.id)) {
            continue;
        }
        cloneArr1.push(v);
    }
    return cloneArr1;
}

console.log(mergeArray(arr1, arr2)); // [ { id: 1 }, { id: 2 }, { id: 3 }, { id: 4 }, { id: 5 } ]
